package yl.hs.bmipfull.viewmodels;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Locale;

/*
 * FilterModel
 * @category
 * @author 谢景广
 * @date 2021-10-22
 */
public class FilterFieldModel {

    public  FilterFieldModel(String fieldName,String fieldType,String displayName){
        this.fieldName = fieldName;
        var typeNArr = fieldType.split("\\.");
        this.fieldType = getType(typeNArr[typeNArr.length-1]);

        this.displayName = displayName;
    }
    public FilterFieldModel(){

    }

    private String getType(String type){
        var s = type;
        switch (type){
            case "Short":
            case "Long":
                s = "Int";
                break;
            case "BigDecimal":
                s = "float";
                break;
        }
        return  s.toLowerCase();
    }

    private String fieldName;
    private String displayName;

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public String getFieldType() {
        return fieldType;
    }

    public void setFieldType(String fieldType) {
        this.fieldType = fieldType;
    }

    private String fieldType;

}
